/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extension.room.phom;

import extension.game.room.RoomExtension;
import extension.phom.handler.ChoosePhomHandler;
import extension.phom.handler.DepositCardHandler;
import extension.phom.handler.EatCardHandler;
import extension.phom.handler.FightCardHandler;
import extension.phom.handler.FinishDealCardHandler;
import extension.phom.handler.GetCardHandler;
import extension.phom.handler.MorePhomHandler;
import extension.phom.handler.PhomCommand;
import extension.phom.handler.ShowPhomHandler;
import extension.phom.handler.TimeOutHandler;

/**
 *
 * @author daz 
 */
public class PhomExtension extends RoomExtension {

    private PhomGame phomGame;
    private PhomResponse response;

    @Override
    public void init() {
        startupRoom();
    }

    @Override
    public void addHandler() {
        super.addHandler();
        addRequestHandler(PhomCommand.FINISH_DEAL, FinishDealCardHandler.class);
        addRequestHandler(PhomCommand.FIGHT_CARD, FightCardHandler.class);
        addRequestHandler(PhomCommand.DRAW_CARD, GetCardHandler.class);
        addRequestHandler(PhomCommand.SHOW_PHOM, ShowPhomHandler.class);
        addRequestHandler(PhomCommand.EAT_CARD, EatCardHandler.class);
        addRequestHandler(PhomCommand.DEPOSIT_CARD, DepositCardHandler.class);
        addRequestHandler(PhomCommand.NOTIFY_PHOM_MORE, MorePhomHandler.class);
        addRequestHandler(PhomCommand.CHOOSE_PHOM, ChoosePhomHandler.class);
        addRequestHandler(PhomCommand.TIME_OUT, TimeOutHandler.class);

    }

    @Override
    public PhomGame getGame() {
        return this.phomGame;
    }

    @Override
    public void initGame(int roomId) {
        response = new PhomResponse(this);
        phomGame = new PhomGame(this, roomId);
        phomGame.start();
    }

    @Override
    public PhomResponse getResponse() {
        return this.response;
    }
}
